/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="goods_attr_value")
public class GoodsAttrValue implements Serializable {
	public GoodsAttrValue() {
	}
	
	private int id;
	
	private int goodsId;
	
	private cn.imvc.app.entities.AttrValue attrValue;
	
	private String attrValueName;
	
	private cn.imvc.app.entities.AttrClass attrClass;
	
	private String attrClassName;
	
	private String attrClassCode;
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_GOODSATTRVALUE_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_GOODSATTRVALUE_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	/**
	 * 商品id外键
	 */
	public void setGoodsId(int value) {
		this.goodsId = value;
	}
	
	/**
	 * 商品id外键
	 */
	@Column(name="goodsId", nullable=false, length=10)	
	public int getGoodsId() {
		return goodsId;
	}
	
	/**
	 * 属性名称
	 */
	public void setAttrValueName(String value) {
		this.attrValueName = value;
	}
	
	/**
	 * 属性名称
	 */
	@Column(name="attrValueName", nullable=true, length=255)	
	public String getAttrValueName() {
		return attrValueName;
	}
	
	/**
	 * 属性类别名称
	 */
	public void setAttrClassName(String value) {
		this.attrClassName = value;
	}
	
	/**
	 * 属性类别名称
	 */
	@Column(name="attrClassName", nullable=true, length=255)	
	public String getAttrClassName() {
		return attrClassName;
	}
	
	/**
	 * 属性类别编码
	 */
	public void setAttrClassCode(String value) {
		this.attrClassCode = value;
	}
	
	/**
	 * 属性类别编码
	 */
	@Column(name="attrClassCode", nullable=true, length=255)	
	public String getAttrClassCode() {
		return attrClassCode;
	}
	
	public void setAttrValue(cn.imvc.app.entities.AttrValue value) {
		this.attrValue = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.AttrValue.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="attrValueId", referencedColumnName="id") })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.AttrValue getAttrValue() {
		return attrValue;
	}
	
	public void setAttrClass(cn.imvc.app.entities.AttrClass value) {
		this.attrClass = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.AttrClass.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="attrClassId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.AttrClass getAttrClass() {
		return attrClass;
	}
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("GoodsAttrValue[ ");
			sb.append("Id=").append(getId()).append(" ");
			sb.append("GoodsId=").append(getGoodsId()).append(" ");
			if (getAttrValue() != null)
				sb.append("AttrValue.Persist_ID=").append(getAttrValue().toString(true)).append(" ");
			else
				sb.append("AttrValue=null ");
			sb.append("AttrValueName=").append(getAttrValueName()).append(" ");
			if (getAttrClass() != null)
				sb.append("AttrClass.Persist_ID=").append(getAttrClass().toString(true)).append(" ");
			else
				sb.append("AttrClass=null ");
			sb.append("AttrClassName=").append(getAttrClassName()).append(" ");
			sb.append("AttrClassCode=").append(getAttrClassCode()).append(" ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
